<?php
// +----------------------------------------------------------------------
// | 火凤凰CMS内容管理系统
// +----------------------------------------------------------------------
// | Copyright (c) 2015~2018 http://cxbs.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 赵志广 <amdin@cxbs.net>
// +----------------------------------------------------------------------
namespace app\admin\controller;

use app\common\controller\Adminbase;
use app\common\model\Chinacode as cxModel;

class Chinacode extends Adminbase {
    /**
     * @return mixed 本方法暂时不清楚那里有使用，暂时保留
     */
    public function cha(){
        if(request()->isPost()){
            $data = input('post.');
            $data = datatrim($data);
            $cxmodel = new \app\common\model\Chinacode();
            $codelist = $cxmodel->chalist($data);
            return $codelist;
        }
    }

    /**
     * @return \think\response\Json 返回下级地区列表
     */
    public function get_don(){
        if (request()->isPost()) {
            $cxmodel = new cxModel();
            $data = input('post.');
            $data = datatrim($data);
            $codelist['dondata'] = $cxmodel->get_don($data['zoneid']);
            $codelist['code'] = '0';
            if(!empty($codelist['dondata']) && isset($codelist['dondata'])){
                $codelist['code'] = '1';
            }
            return json($codelist);
        }
    }
    public function get_this(){
        $cxmodel = new cxModel();
        $data = input('post.');
        $data = datatrim($data);
        $codelist['dondata'] = $cxmodel->get_this($data['zoneid']);
        $codelist['code'] = '0';
        if(!empty($codelist['dondata']) && isset($codelist['dondata'])){
            $codelist['code'] = '1';
        }
        return json($codelist);
    }
}
